//
//  EventViewInWeekView.swift
//  YOKO
//
//  Created by Zoe_G on 16/5/27.
//  Copyright © 2016年 15Tec. All rights reserved.
//

import UIKit

class EventViewInWeekView: UIView {
    
    var eventColor: Int!
    var titleLabel = UILabel()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.layer.cornerRadius = 2.0
        self.layer.masksToBounds = true
        
        setNeedsDisplay()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        setNeedsDisplay()
    }

    
    override func drawRect(rect: CGRect) {
        
        //设置左上角圆角
//        let maskPath = UIBezierPath.init(roundedRect: self.frame, byRoundingCorners: .TopLeft, cornerRadii: CGSizeMake(iconHeight, iconHeight))
//        let maskLayer = CAShapeLayer()
//        maskLayer.path = maskPath.CGPath
//        maskLayer.frame = self.frame
//        self.layer.mask = maskLayer
        
        DrawUtil.drawLine(CGPointMake(1, 0), end: CGPointMake(1, self.frame.height), withColor: YOKOColor.TypeColors[eventColor], withWidth: 3)
        
        titleLabel.frame = CGRectMake( 4.0, 0, self.frame.width-4.0, self.frame.height)
        titleLabel.font = UIFont.systemFontOfSize(8.0)
        titleLabel.textColor = YOKOColor.fontBlack
        titleLabel.lineBreakMode = .ByWordWrapping
        titleLabel.numberOfLines = 0
        self.addSubview(titleLabel)
        
    }

}
